home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_DLCCENT.PRG
< prev
next >
Wrap
Text File
|
1993-05-06
|
4KB
|
143 lines
PROCEDURE _DLCCEnt
PARAMETERS pcPanel, pcCatName
*----------------------------------------------------------------------------
* NAME
* _DLCCEnt - Catalog Entry Program
*
* DESCRIPTION
*
* PARAMETERS
* pcPanel =
* pcCatName =
*
*----------------------------------------------------------------------------
SET ECHO OFF
IF SET( "TALK" ) = "ON"
SET TALK OFF
lTalk = .T.
ELSE
lTalk = .F.
ENDIF
cDBBLib = "DBBDSGN"
lError = .F.
ON ERROR lError = .T.
SET LIBRARY TO ( cDBBLib )
IF lError
lError = .F.
SET LIBRARY TO HOME() + cDBBLib
IF lError
DO _Err_Box WITH [DBB not installed correctly]
ENDIF
ENDIF
ON ERROR
IF TYPE( "DBW_HELP" ) <> "C"
RELEASE DBW_HELP
PUBLIC DBW_HELP
DBW_HELP = "DLGHELP" && Name of help file for dialogs
ENDIF
IF TYPE( "FXL_DEV" ) <> "L"
RELEASE FXL_DEV
PUBLIC FXL_DEV
FXL_DEV = .F. && Developer mode on
ENDIF
IF lTalk
SET TALK ON
ENDIF
RETURN
*-- EOP: _DLCCEnt WITH pcPanel, pcCatName
PROCEDURE _Err_Box
PARAMETERS pc_msg
*----------------------------------------------------------------------------
* NAME
* _Err_Box - Display an error box
*
* SYNOPSIS
* DO _Err_Box WITH <pc_msg>
*
* DESCRIPTION
* _Err_Box will display the <pc_msg> string in a box and prompt the
* user to press any key to continue processing. _Err_Box will display
* the message based on the length of <pc_msg>.
*
* PARAMETERS
* pc_msg - the error message to display in the box. If the length is
* greater than 76, the trailing part is chopped off.
*
* EXAMPLE
* DO _Err_Box WITH "Incorrect window size"
* Displays the message in a window as follows at row 9 on the screen:
* +------------------------------+
* | |
* | Incorrect window size |
* | |
* | Press any key to continue... |
* | |
* +------------------------------+
* Note that the width of the window will increase to accommodate a longer
* message string.
*
* LIMITATIONS
* Truncates the message after 76 characters. Assumes an 80 character
* wide screen. Looks best with SET CURSOR OFF.
*
*----------------------------------------------------------------------------
PRIVATE lc_anykey, lc_msg, lc_msglen, lc_win, ln_press, ln_width, ll_trap,;
ll_escape
lc_anykey = [Press any key to continue...]
ln_press = LEN( lc_anykey )
lc_win = WINDOW() && Currently activated window if any
lc_msg = LTRIM( RTRIM( pc_msg ) ) && Trimmed message
ln_msglen = LEN( lc_msg ) && Trimmed length of message
ln_width = 0 && Width of display area in window.
ll_escape = SET("ESCAPE") = "ON"
*-- Determine the width needed for the window:
IF ln_msglen <= ln_press
ln_width = ln_press
ELSE
*-- Make sure the message fits in the window:
IF ln_msglen > 76
lc_msg = LEFT( lc_msg, 76 )
ln_msglen = 76
ENDIF
ln_width = ln_msglen
ENDIF
DEFINE WINDOW _err_box FROM 9, ((76 - ln_width) + .5) / 2 ;
TO 15, (ln_width + 83) / 2 DOUBLE
ln_width = ( ln_width + 2 )
*-- Display the message and prompt to the window and wait for a key press
ACTIVATE WINDOW _err_box
@ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
@ 3, ( ln_width - ln_press ) / 2 SAY lc_anykey
SET CONSOLE OFF && For mouse click recognition
WAIT
SET CONSOLE ON
*-- Clean up the window display and reactivate the previous window
RELEASE WINDOW _err_box
IF ISBLANK( lc_win )
ACTIVATE SCREEN
ENDIF
IF ll_escape
SET ESCAPE ON
ELSE
SET ESCAPE OFF
ENDIF
RETURN
*-- EOP: _Err_Box WITH pc_msg